home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / mail / pine3.96.tar.gz / pine3.96.tar / pine3.96 / pine / osdep / bld_path next >
Text File  |  1996-03-15  |  1KB  |  45 lines

  1. /*----------------------------------------------------------------------
  2.       Paste together two pieces of a file name path
  3.  
  4.   Args: pathbuf      -- Put the result here
  5.         first_part   -- of path name
  6.         second_part  -- of path name
  7.  
  8.  Result: New path is in pathbuf.  No check is made for overflow.  Note that
  9.      we don't have to check for /'s at end of first_part and beginning
  10.      of second_part since multiple slashes are ok.
  11.  
  12. BUGS:  This is a first stab at dealing with fs naming dependencies, and others 
  13. still exist.
  14.   ----*/
  15. void
  16. build_path(pathbuf, first_part, second_part)
  17.     char *pathbuf, *first_part, *second_part;
  18. {
  19.     if(!first_part)
  20.       strcpy(pathbuf, second_part);
  21.     else
  22.       sprintf(pathbuf, "%s%s%s", first_part,
  23.           (*first_part && first_part[strlen(first_part)-1] != '/')
  24.             ? "/" : "",
  25.           second_part);
  26. }
  27.  
  28.  
  29. /*----------------------------------------------------------------------
  30.   Test to see if the given file path is absolute
  31.  
  32.   Args: file -- file path to test
  33.  
  34.  Result: TRUE if absolute, FALSE otw
  35.  
  36.   ----*/
  37. int
  38. is_absolute_path(path)
  39.     char *path;
  40. {
  41.     return(path && (*path == '/' || *path == '~'));
  42. }
  43.  
  44.  
  45.